package com.hqsj.config;

import com.github.sd4324530.fastweixin.api.CustomAPI;
import com.github.sd4324530.fastweixin.api.MaterialAPI;
import com.github.sd4324530.fastweixin.api.UserAPI;
import com.github.sd4324530.fastweixin.api.config.ApiConfig;
import org.apache.catalina.core.ApplicationContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Created by huangying on 2017/4/13.
 */
@Configuration
public class WeixinConfiguration {

    @Value("${weixin.appID}")
    private final String appid = null;
    @Value("${weixin.appsecret}")
    private final String secret = null;

    @Bean
    ApiConfig apiConfig() {
        return new ApiConfig(appid, secret);
    }

    @Bean
    CustomAPI customAPI() {
        return new CustomAPI(apiConfig());
    }

    @Bean
    MaterialAPI materialAPI() {
        return new MaterialAPI(apiConfig());
    }

    @Bean
    UserAPI userAPI() {
        return new UserAPI(apiConfig());
    }
}
